ConfigSelectionElement = Class("ConfigSelectionElement", EventDispatcher)

---@diagnostic disable-next-line: duplicate-set-field
function ConfigSelectionElement:ctor(args)
    EventDispatcher.ctor(self)
    self.id = args.id
    self.name = args.name
    self.desc = args.desc
end

function ConfigSelectionElement:changeName(name)
    self.name = name
end

ConfigSelectionElement.defineProp("name", {
    get = function (self)
        return self._name
    end,
    set = function (self, key, val)
        self._name = val
        self:emit(ConfigEvent.ChangeSelectionElementName, val)
    end
})

ConfigSelectionElement.defineProp("desc", {
    get = function (self)
        return self._desc
    end,
    set = function (self, key, val)
        self._desc = val
        self:emit(ConfigEvent.ChangeSelectionElementDesc, val)
    end
})

function ConfigSelectionElement:getSaveData()
    local data = {}
    data.id = self.id
    data.name = self.name
    data.desc = self.desc
    return data
end